Skip to content

feat: add stdin request support#760

Open
inickt wants to merge 1 commit intolivekit:mainfrom
inickt:request-stdin
Open

feat: add stdin request support#760
inickt wants to merge 1 commit intolivekit:mainfrom
inickt:request-stdin

Conversation

@inickt
Copy link
Contributor

@inickt inickt commented Jan 29, 2026

Enables reading the request json from STDIN when - is specified as an arg instead of a file path. - is commonly used in CLI tools to indicate reading from STDIN.

For example, pbpaste | lk sip inbound create - to use clipboard contents (on macOS) for creating a SIP trunk.

As I write this I realize pbpaste | lk sip inbound create /dev/stdin is functionally equivalent without code changes, so if that is preferred feel free to close...

disclaimer: mostly generated by codex, with manual review

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for reading input from stdin by using "-" as an argument, providing an alternative to file paths.
    • Updated help text to document stdin input capability.
  • Bug Fixes

    • Added validation to prevent multiple stdin arguments in a single command.

✏️ Tip: You can customize this high-level summary in your review settings.

@CLAassistant
Copy link

CLAassistant commented Jan 29, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

The changes add stdin support to the request processing logic by treating "-" as a signal to read from standard input. The ReadRequestFileOrLiteral function now checks for "-" before attempting file operations, RequestDesc appends a hint about stdin capability, and createAndPrintReqs validates that "-" is used at most once across multiple arguments.

Changes

Cohort / File(s) Summary
stdin Support Enhancement
cmd/lk/proto.go
Modified ReadRequestFileOrLiteral to read from stdin when "-" is provided; updated RequestDesc with "(or - for stdin)" hint; added validation in createAndPrintReqs to prevent multiple stdin usage when processing multiple arguments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A dash now opens stdin's door,
No files needed anymore!
Just "-" and watch the data flow,
One stream at once—that's all you need to know! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding stdin request support via the '-' argument convention.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants